package com.dabaozhan.modules.wx_app.service.impl;

import com.dabaozhan.common.entity.Query;
import com.dabaozhan.common.utils.OmsPage;
import com.dabaozhan.modules.wx_app.dao.QuotationtrendMapper;
import com.dabaozhan.modules.wx_app.entity.QuotationtrendEntity;
import com.dabaozhan.modules.wx_app.service.QuotationtrendService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * @author houzhong
 * @date 2019-01-14 18:00
 */
@Service("quotationtrendService")
public class QuotationtrendServiceImpl implements QuotationtrendService {

    @Autowired
    private QuotationtrendMapper quotationtrendMapper;

    @Override
    public int findByQuotationtrendCount(Map<String, Object> params) {
        Query query = new Query(params);
        return quotationtrendMapper.findByQuotationtrendCount(query);
    }

    @Override
    public OmsPage<QuotationtrendEntity> findByQuotationtrend(Map<String, Object> params) {
        Query query = new Query(params);
        OmsPage<QuotationtrendEntity> pages = new OmsPage<QuotationtrendEntity>();
        pages.setTotal(quotationtrendMapper.findByQuotationtrendCount(query));
        List<QuotationtrendEntity> list = quotationtrendMapper.findByQuotationtrend(query);
        pages.setResult(list);
        return pages;
    }

    @Override
    public QuotationtrendEntity getQuotationtrendId(String id) {
        return quotationtrendMapper.getObjectById(id);
    }
}
